package com.syh.jn.scm.domain.supplier.entity.base.logistics;

import cn.redscarf.commons.util.bean.ExtBeanUtils;
import cn.redscarf.commons.util.other.ExtAssert;
import com.syh.core.ddd.domain.AbstractSimpleAggregate;
import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.jn.scm.dto.supplier.base.logistics.logisticsTruck.LogisticsTruckMto;
import com.syh.jn.scm.dto.supplier.base.logistics.logisticsTruck.LogisticsTruckSto;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 物流车型
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class LogisticsTruck extends AbstractSimpleAggregate<Long> {
  public LogisticsTruck () {}

  /**
   * 物流车型增加
   * @param sto
   */
  public LogisticsTruck (LogisticsTruckSto sto) {
    ExtAssert.notNull(sto, "对象为空");
    ValidationUtils.validate(sto);

    this.createTimeStamp = System.currentTimeMillis();
    ExtBeanUtils.copyProperties(sto, this);
  }

  /**
   * 物流车型修改
   * @param mto
   */
  public void modify (LogisticsTruckMto mto) {
    ExtAssert.notNull(mto, "对象为空");
    ValidationUtils.validate(mto);
    ExtBeanUtils.copyProperties(mto, this);
    this.lastUpdateTimeStamp = System.currentTimeMillis();
  }

  /**
   * 数据销毁
   */
  public void destroy() {
  }
  /**
   * 物流公司id
   */
  private Long logisticsId;
  /**
   * 货车类型: 1小型货车,2中型货车,3大型货车
   */
  private Short truckType;
  /**
   * 起步价(元)
   */
  private BigDecimal startingPrice;
  /**
   * 每公里价格
   */
  private BigDecimal perKilometrePrice;
  /**
   * 是否冷链车:-1否,1是
   */
  private Short isColdChain;
}
